#ifndef PARSER_H
#define PARSER_H

#include "Tokenizer.h"

Tokenizer tokenizer;
map<string,Token*> not_declared;
map<string,Symbol*> symbol_table;
map<string,Scope*> class_scopes;
Scope* virtual_scope = NULL;
Scope* scope = NULL;
Scope* constructor_scope = NULL;
Token* token = NULL;
bool in_class = false;
bool in_function = false;
bool in_loop = false;
string at_class = "";
string at_parent_class = "";
string def_code = "";
int token_nr = 0;

void tokenize(string code, string prefix, string suffix) ;

Scope* new_scope();

Token* advance(const string& id = "");
Token* expression(int rbp);
Token* statement();
Token* statements();
void find_classes();



class Parser
{
	const vector<string>& m_files;
	const string& m_exe;
public:
	Parser(const vector<string>& files,const string& executable);

	bool Parse();
	void Compile();
	void Build();
	void Search(Token* s,ofstream& compiled,string tab);
	
};

#endif
